package com.becca.cake.service.coupon;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.becca.cake.core.exception.ServiceException;
import com.becca.cake.model.coupon.CouponModel;
import com.becca.cake.model.coupon.CouponSaleSlipModel;
import com.becca.cake.model.system.AdminDO;

/**
 * 优惠码管理service接口
 * @copyright  尊星(上海)信息科技有限公司
 * @author yellow
 * @date 2016年7月4日 下午2:49:37
 */
public interface ICouponService {
    /**
     *  查询优惠码
     * @param map
     * @return
     * @throws ServiceException
     */
    List<CouponModel> selectCoupon(Map<String, Object> map) throws ServiceException;

    /**
     * 查询优惠码总条数
     * @param map
     * @return
     * @throws ServiceException
     */
    Long selectCouponCount(Map<String, Object> map) throws ServiceException;
    
    /**
     *  查询优惠码状态
     * @param map
     * @return
     * @throws ServiceException
     */
    List<CouponModel> selectCouponStatus(Map<String, Object> map) throws ServiceException;

    /**
     * 查询优惠码状态总条数
     * @param map
     * @return
     * @throws ServiceException
     */
    Long selectCouponStatusCount(Map<String, Object> map) throws ServiceException;

    /**
     * 
     * 添加或修改优惠码
     * @param couponModel
     * @throws ServiceException
     */
    void insertOrUpdateCoupon(CouponModel couponModel, String isAutomatic,
                              Integer couponCodeNumber, AdminDO adminDo) throws ServiceException;

    /**
     * 根据id查询优惠码对象
     * @param id
     * @return
     * @throws ServiceException
     */
    CouponModel queryCouponById(Integer id) throws ServiceException;

    /**
     * 批量导出
     * @param list
     * @throws ServiceException
     */
    void exportCouponsToExcel(HttpServletRequest request, HttpServletResponse response,
                              String jsonList) throws ServiceException;

    /**
     * 优惠码激活
     * @param couponIds
     * @param adminDo
     * @throws ServiceException
     */
    void updateActivatedCoupon(String couponIds, Byte couponType, String couponEndDate,String salesName,
                               AdminDO adminDo) throws ServiceException;

    /**
     *  查询销售数据
     * @param map
     * @return
     * @throws ServiceException
     */
    List<CouponSaleSlipModel> selectCouponSale(Map<String, Object> map) throws ServiceException;

    /**
     *  获取销售数据条数
     * @param map
     * @return
     * @throws ServiceException
     */
    Long selectCouponSaleSlipCount(Map<String, Object> map) throws ServiceException;

    /**
     * 删除销售信息
     * @param id
     * @throws ServiceException
     */
    void deleteCouponSaleById(Integer id) throws ServiceException;

    /**
     * 根据id查询销售信息
     * @param couponSaleId
     * @return
     */
    CouponSaleSlipModel selectCouponSaleById(Integer couponSaleId);

    /**
     * 添加或修改销售信息
     * @param CouponSaleSlipModel
     * @throws Exception
     */
    void insertOrUpdateCouponSale(CouponSaleSlipModel couponSaleSlipModel, AdminDO adminDo)
                                                                                           throws Exception;
}
